/*
 * AA.h
 *
 *  Created on: May 21, 2012
 *      Author: marchi
 */

#ifndef AA_H_
#define AA_H_
#include "FStreamC.h"
#include "FStreamF.h"


class AA {
	double h;
	void readX(FstreamC * fin){
		FILE * fp=fin->getfin();
		fscanf(fp,"%lf",&h);
	}
	void readX(FstreamF * fin){
		ifstream & fp=fin->getfin();
		fp>>h;
	}
public:
	AA():h(0.0){};
	AA(double n):h(n){};
	virtual ~AA();
	void print(){cout << h << endl;}
	friend FStream & operator>>(FStream & fin, AA & y){
		if(FstreamC * finC=dynamic_cast<FstreamC *> (&fin))
			y.readX(finC);
		else if(FstreamF * finF=dynamic_cast<FstreamF *> (&fin))
			y.readX(finF);


		return fin;
	}
};

#endif /* AA_H_ */
